<%--
 *  File:    ProtocolDetailMainInfo.jsp
 *  @Author: AlexBi
 *  Date:    2010/03/09
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>


<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "PCM";
 	String strTableName = "";
	String privilegeCode = "11201";    
    String contextPath = request.getContextPath(); 
%>

<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>ProtocolDetail</title>
<PageFlow:CheckPageFlow pageName="p_protocoldetail"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>

<%@ include file="/inc/SummaryDivision.inc" %>

<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector totalsummary = (Vector)pageContext.getAttribute("protocoldetail");
  	if(totalsummary == null)
  	{
  		totalsummary = new Vector();
  	}
%>

<script language="JavaScript" >

function page_add(){
	if (!isNumeric(cform.salestarget.value))
		{
				alert("<%= message.getMessageDesc("Enter_The_Number_Must_Be") %>");
				cform.salestarget.value="";
				cform.salestarget.focus();
				return;
		}
	if(!checkForm(cform))   return; 
    if(cform.agency.value=="Y")
      {
       	if(cform.salestarget.value=="" || cform.salestarget.value == "0"|| cform.salestarget.value < 0)
			{
				alert("<%= message.getMessageDesc("Agency_Protocol_saletarget_more_then_zero") %>");
				return;
			}
       }

     cform.actionname.value = "add";
  	 cform.target = "_self";
  	 isRunning = true;
  	 cform.submit();
}

function page_delete(){
    if(isNullChecked(cform.deleteids))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
	cform.submit();
}
function page_setproduct(id,umcode,prodcode,prodname){
	document.cform.prodid.value=id;
	document.cform.productname.value=prodname;
}

function page_back(){
	parent.location.href="ProtocolManagement.jsp?<%= OvalTools.randomURL() %>";
}
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher">
<input type="hidden" name="pagename" value="p_protocoldetail">
<input type="hidden" name="actionname">
<custom:hidden name="userinfo" property="orgid" scope="session"/>
<custom:hidden name="userinfo" property="userid" changedName="maker" scope="session"/>
<custom:hidden property="agency"/>
<custom:hidden property="protocolid"/>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
      <tr>
        <td>
          <table width="100%" border="0" cellspacing="0">
             <tr>
             	<td class="td_right">
             	     &nbsp;
             	</td>
             </tr>
          </table>
        </td>
      </tr>
</table>
<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr class="deepblue-left" >
		  <td class="title_center">&nbsp;</td>
          <td class="title_center" width="40%"><%= label.getLabelName("L_Product") %> </td>
          <td class="title_center" width="30%"><%= label.getLabelName("L_Price") %></td>
          <td class="title_center" width="40%"><%= label.getLabelName("L_SalesTargets") %></td>
        </tr>
		 <% //--------------------------------------  default value definition --%>
          	<%
            	int i = 0;
             	String strClassType = new String();
          	%>

          	<% //--------------------------------------  loop results --%>
		<logic:iterate id="onerow" collection="<%= totalsummary %>" indexId="idx">
           	<%
            	HashMap tempMap = (HashMap)pageContext.getAttribute("onerow");
            	if(i%2 == 1)
            	{
              		strClassType = "td-listrom";
            	}else{
              		strClassType = "";
            	}
            	i++;
          	%>
          	<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  class="none">
          		<td width="5" class="title_center">
              		&nbsp;
            	</td>
            	<td class="title_center">
            		<custom:write name="onerow" property="prdn" nbsp="true" />
            	</td>
            	<td class="title_center">
            		<custom:write name="onerow" property="listprice"  nbsp="true"/>
            	</td>  	
            	<td class="title_center">
            		<custom:write name="onerow" property="salestarget"  nbsp="true"/>
            	</td>

     		 </tr>
     	 </logic:iterate>
     	 
 </table>     
<table width="100%">
	<tr>
	  <td class="summary_top"></td>
	</tr>
	<tr>
	 <td class="td_center">
	<!--  	<a onclick="page_submit();"><custom:button type="1" label="L_Submit" imgsrc="save_btn.gif" border="0" style="width:60"/></a>-->
	<!--  	<a onclick="page_save();"><custom:button type="1" label="L_Save" imgsrc="save_btn.gif" border="0" style="width:60"/></a>-->
	    <a onclick="page_back()"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>
	 </td>
	</tr>
</table>
</form>
</body>
</html>